﻿using System.Windows.Media;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        /// <summary>
        /// 注意：只支持Brushes类中定义的部分值。
        /// </summary>
        /// <param name="brush"></param>
        public static void BorderColorLaunch(Brush brush)
        {
            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

            LunarPresentation.Expressions.Expression curEx
                = Globals.selectedEditor.SelectedExpression;

            ModifingItem mi = new ModifingItem();
            Action action = new Action(curEx.ExID, -1, curEx.GetType().Name, "BorderColor",
               ColorPicker.GetBrushName(curEx.BorderColor), ColorPicker.GetBrushName(brush));
            curEx.BorderColor = brush;
            mi.Add(action);
            curEx.Editor.Do(mi);
        }
    }
}
